package eteam.aps.systeminterface.service;

import eteam.aps.common.QueryResult;
import eteam.aps.common.R;
import eteam.aps.common.exceptions.AuthException;
import eteam.aps.systeminterface.model.dto.CustclassDto;
import eteam.aps.systeminterface.model.dto.CustomerDto;
import eteam.aps.systeminterface.model.entity.CustclassEntity;
import eteam.aps.systeminterface.model.entity.CustomerEntity;
import eteam.aps.systeminterface.model.reqparam.IdParam;
import eteam.aps.systeminterface.model.reqparam.QueryCustomerParam;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Update;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * 客户资料控制器
 */
public interface ICustController {
    /**
     * 根据父级分类ID获取下级分类列表
     *
     * @param classId: 上级分类ID
     * @return
     */
    @GetMapping(value = "/api/cust/getclasslist")
    R<List<CustclassEntity>> getClassList(@RequestParam String classId) throws Exception, AuthException;

    /**
     * 新增分类
     *
     * @param custclassDto: 分类信息
     * @return
     */
    @PostMapping(value = "/api/cust/createclass")
    R createClass(@Validated(Insert.class) @RequestBody CustclassDto custclassDto) throws Exception, AuthException;

    /**
     * 更新分类
     *
     * @param custclassDto: 分类信息
     * @return
     */
    @PostMapping(value = "/api/cust/updateclass")
    R updateClass(@Validated(Update.class) @RequestBody CustclassDto custclassDto) throws Exception, AuthException;

    /**
     * 删除分类
     *
     * @param idParam: Id参数
     * @return
     */
    @PostMapping(value = "/api/cust/deleteclass")
    R deleteClass(@Validated @RequestBody IdParam idParam) throws Exception, AuthException;


    /**
     * 分页查询客户信息
     *
     * @param requestDto: 查询参数
     * @return
     */
    @GetMapping(value = "/api/cust/querypagelist")
    R<QueryResult<CustomerEntity>> queryCustPageList(@Validated QueryCustomerParam requestDto) throws Exception, AuthException;

    /**
     * 新增客户
     *
     * @param customerDto: 客户信息
     * @return
     */
    @PostMapping(value = "/api/cust/createcustomer")
    R createCustomer(@Validated(Insert.class) @RequestBody CustomerDto customerDto) throws Exception, AuthException;

    /**
     * 更新客户
     *
     * @param customerDto: 客户信息
     * @return
     */
    @PostMapping(value = "/api/cust/updatecustomer")
    R updateCustomer(@Validated(Update.class) @RequestBody CustomerDto customerDto) throws Exception, AuthException;

    /**
     * 删除客户
     *
     * @param idParam: Id参数
     * @return
     */
    @PostMapping(value = "/api/cust/deletecustomer")
    R deleteCustomer(@Validated @RequestBody IdParam idParam) throws Exception, AuthException;
}
